package spindles.api.domain;

import java.io.Serializable;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.sleepycat.persist.model.Persistent;
import com.sleepycat.persist.model.PrimaryKey;

@Persistent
public class DomainObject implements Comparable, Serializable{
	
	/**
	 * 
	 */
	private transient static final long serialVersionUID = 2829014847876502978L;
	
	@PrimaryKey(sequence="id")
	private long id;	
	
	public DomainObject(){
		
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public String toString(){
		return ToStringBuilder.reflectionToString(this);
	}
	
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}
	
	public int compareTo(Object o) {
		return CompareToBuilder.reflectionCompare(this, o);
	}
	
	public boolean equals(Object o){
		return EqualsBuilder.reflectionEquals(this, o);
	}

}
